Let \[p(x,y) =
\begin{cases} x + y &\quad \text{if } x \ge 0 \text{ and } y \ge 0, \\
x - 2y &\quad \text{if } x < 0 \text{ and } y < 0, \\
3x + y &\quad \text{otherwise}.
\end{cases}
\]What is $p(p(1,-1),p(-5,-2))$?
Solution: First, we find $p(1,-1)$. Since it falls into the otherwise category, $p(1,-1) = 3 \cdot 1 - 1 = 2$.

Next, we find $p(-5,-2)$. Since both numbers are negative, it follows that $p(-5,-2) = -5 - 2(-2) = -1$.

Thus, $p(p(1,-1),p(-5,-2)) = p(2,-1)$. This again falls into the otherwise category, and we find that $p(2,-1) = 3 \cdot 2 - 1 = \boxed{5}$.